import hashlib
import itertools
import string

def find_valid_token():
    # We need to find a token where:
    # 1. MD5(token) has same characters at positions 1, 14, 17
    # 2. Character at position 31 is '3'
    
    # Try all possible single characters first (quick check)
    for c in string.printable:
        token = c
        md5_hash = hashlib.md5(token.encode()).hexdigest()
        if (md5_hash[1] == md5_hash[14] == md5_hash[17]) and md5_hash[31] == '3':
            return token
    
    # If single characters don't work, try longer strings
    # This is brute-force and may take time
    length = 2
    while True:
        for product in itertools.product(string.printable, repeat=length):
            token = ''.join(product)
            md5_hash = hashlib.md5(token.encode()).hexdigest()
            if (md5_hash[1] == md5_hash[14] == md5_hash[17]) and md5_hash[31] == '3':
                return token
        length += 1
        if length > 10:  # Prevent infinite loop in demo
            return None

valid_token = find_valid_token()
if valid_token:
    print(f"Valid token found: {valid_token}")
    print(f"MD5 hash: {hashlib.md5(valid_token.encode()).hexdigest()}")
else:
    print("No valid token found in reasonable search space")